/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author Cheng
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '/@/api/model/baseModel';

const { adminPath } = useGlobSetting();

export interface InContract extends BasicModel<InContract> {
  name?: string; // 合同名称
  aenterpriseId?: string; // 业主单位ID
  aenterpriseName?: string; // 业主单位名称
  benterpriseId?: string; // 维保单位ID
  benterpriseName?: string; // 维保单位名称
  startDate?: string; // 合同起始年月
  endDate?: string; // 合同结束年月
  createTime?: string; // 创建日期
  updateTime?: string; // 更新日期
  state?: string; // 合同状态（有效， 无效）
  fileSrc?: string; // 合同附件地址
  fileSrcId?: string; // 合同附件地址id
  dataPermissions?: string; // 数据权限标识，一般与业主单位一致
  deleted?: string; // 是否已删除
}

export const inContractList = (params?: InContract | any) =>
  defHttp.get<InContract>({ url: adminPath + '/maintenance/management/inContract/list', params });

export const inContractListData = (params?: InContract | any) =>
  defHttp.post<Page<InContract>>({ url: adminPath + '/maintenance/management/inContract/listData', params });

export const inContractForm = (params?: InContract | any) =>
  defHttp.get<InContract>({ url: adminPath + '/maintenance/management/inContract/form', params });

export const inContractSave = (params?: any, data?: InContract | any) =>
  defHttp.postJson<InContract>({ url: adminPath + '/maintenance/management/inContract/save', params, data });

export const inContractDelete = (params?: InContract | any) =>
  defHttp.get<InContract>({ url: adminPath + '/maintenance/management/inContract/delete', params });
